package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                        import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.ProductRelationDeferredMapper;
import com.ruoyi.bizsys.domain.ProductRelationDeferred;
import com.ruoyi.bizsys.service.IProductRelationDeferredService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 产品关系延期产品Service业务层处理
 *
 * @author wqg
 * @date 2022-06-09
 */
@Service
public class ProductRelationDeferredServiceImpl extends ServiceImpl<ProductRelationDeferredMapper,ProductRelationDeferred> implements IProductRelationDeferredService {

    /**
     * 查询产品关系延期产品
     *
     * @param id 产品关系延期产品ID
     * @return 产品关系延期产品
     */
    @Override
    public ProductRelationDeferred selectProductRelationDeferredById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询产品关系延期产品列表
     *
     * @param productRelationDeferred 产品关系延期产品
     * @return 产品关系延期产品
     */
    @Override
    public List<ProductRelationDeferred> selectProductRelationDeferredList(ProductRelationDeferred productRelationDeferred) {
        return this.list(new QueryWrapper<>(productRelationDeferred).last("order by id desc"));
    }

    /**
     * 新增产品关系延期产品
     *
     * @param productRelationDeferred 产品关系延期产品
     * @return 结果
     */
            @Override
    public int insertProductRelationDeferred(ProductRelationDeferred productRelationDeferred) {
                                                                                                                                                                                productRelationDeferred.setCreateTime(DateUtils.getNowDate());
                                                                    return baseMapper.insert(productRelationDeferred);
    }

    /**
     * 修改产品关系延期产品
     *
     * @param productRelationDeferred 产品关系延期产品
     * @return 结果
     */
            @Override
    public int updateProductRelationDeferred(ProductRelationDeferred productRelationDeferred) {
                                                                                                                                                                                                                        productRelationDeferred.setUpdateTime(DateUtils.getNowDate());
                            return baseMapper.updateById(productRelationDeferred);
    }

    /**
     * 批量删除产品关系延期产品
     *
     * @param ids 需要删除的产品关系延期产品ID
     * @return 结果
     */
            @Override
    public int deleteProductRelationDeferredByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除产品关系延期产品信息
     *
     * @param id 产品关系延期产品ID
     * @return 结果
     */
    @Override
    public int deleteProductRelationDeferredById(Long id) {
        return baseMapper.deleteById(id);
    }

}
